package seteam12;

import java.util.Random;

public class FixedSudokusGenerator implements IGenerator {
    Random rand;

    public FixedSudokusGenerator() {
	rand = new Random();
    }

    @Override
    public void generateFill(SudokuBoard board, int dif) {
	int[][][] boards = new int[5][][];
	// Solvable
	boards[0] = new int[][] { { 1, 0, 9, 3, 0, 0, 8, 0, 0 },
		{ 0, 4, 0, 6, 5, 0, 0, 3, 0 }, { 0, 0, 0, 0, 0, 0, 1, 0, 2 },
		{ 0, 9, 5, 1, 0, 0, 0, 8, 0 }, { 0, 2, 0, 0, 8, 9, 6, 0, 4 },
		{ 0, 0, 0, 4, 0, 7, 0, 0, 9 }, { 0, 5, 0, 7, 4, 0, 3, 0, 8 },
		{ 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 6, 0, 2, 0, 0, 0, 0, 7, 0 } };

	// Solvable!
	boards[1] = new int[][] { { 0, 0, 0, 0, 0, 0, 0, 0, 0 },
		{ 0, 0, 0, 0, 0, 3, 0, 8, 5 }, { 0, 0, 1, 0, 2, 0, 0, 0, 0 },
		{ 0, 0, 0, 5, 0, 7, 0, 0, 0 }, { 0, 0, 4, 0, 0, 0, 1, 0, 0 },
		{ 0, 9, 0, 0, 0, 0, 0, 0, 0 }, { 5, 0, 0, 0, 0, 0, 0, 7, 3 },
		{ 0, 0, 2, 0, 1, 0, 0, 0, 0 }, { 0, 0, 0, 0, 4, 0, 0, 0, 9 } };

	// Solvable
	boards[2] = new int[][] { { 1, 2, 0, 4, 0, 0, 3, 0, 0 },
		{ 3, 0, 0, 0, 1, 0, 0, 5, 0 }, { 0, 0, 6, 0, 0, 0, 1, 0, 0 },
		{ 7, 0, 0, 0, 9, 0, 0, 0, 0 }, { 0, 4, 0, 6, 0, 3, 0, 0, 0 },
		{ 0, 0, 3, 0, 0, 2, 0, 0, 0 }, { 5, 0, 0, 0, 8, 0, 7, 0, 0 },
		{ 0, 0, 7, 0, 0, 0, 0, 0, 5 }, { 0, 0, 0, 0, 0, 0, 0, 9, 8 } };

	// Solvable
	boards[3] = new int[][] { { 0, 0, 0, 0, 0, 9, 2, 0, 4 },
		{ 1, 8, 0, 4, 0, 0, 0, 0, 0 }, { 0, 0, 0, 7, 0, 0, 0, 0, 0 },
		{ 4, 0, 0, 2, 6, 0, 0, 5, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0 },
		{ 0, 0, 2, 0, 4, 1, 0, 7, 0 }, { 5, 0, 1, 0, 9, 0, 8, 0, 7 },
		{ 0, 3, 0, 0, 0, 8, 0, 2, 0 }, { 0, 0, 8, 0, 0, 3, 6, 0, 9 } };

	// Solvable
	boards[4] = new int[][] { { 5, 3, 0, 0, 7, 0, 0, 0, 0 },
		{ 6, 0, 0, 1, 9, 5, 0, 0, 0 }, { 0, 9, 8, 0, 0, 0, 0, 6, 0 },
		{ 8, 0, 0, 0, 6, 0, 0, 0, 3 }, { 4, 0, 0, 8, 0, 3, 0, 0, 1 },
		{ 7, 0, 0, 0, 2, 0, 0, 0, 6 }, { 0, 6, 0, 0, 0, 0, 2, 8, 0 },
		{ 0, 0, 0, 4, 1, 9, 0, 0, 5 }, { 0, 0, 0, 0, 8, 0, 0, 7, 9 } };

	int num = rand.nextInt(boards.length);

	board.setValues(boards[num]);

    }

}
